#ifndef _CMDMANAGECOM_H_
#define _CMDMANAGECOM_H_

#define ARRAY_SIZE(arr)		(sizeof(arr)/sizeof(*arr))

#define MAX_COMMAND_NUM				500
#define	NON_SECOND_PARAM			-1
#define CHAR_LF						10
#define CHAR_RE						13

#define BUFFER_LENGTH_NULL			-1 
#define COMMAND_BUFFER_LENGTH		512
#define COMMAND_NAME_LENGTH			32


#define	DATA_TYPE_INT			1
#define	DATA_TYPE_FLOAT			2
#define	DATA_TYPE_STRING		3
#define	DATA_TYPE_LONG			4


//Return value of CMDManage
#define RTN_CMD_OK						1		//OK
#define RTN_CMD_FAIL					0		//Communication error
#define RTN_CMD_PARAM_RANGE				1001		//Input parameter is out of range 
#define RTN_CMD_READONLY				1002		//Can not write a readonly parameter 
#define RTN_CMD_RESPONSE				1003		//Response error,need to reset the command format  
#define RTN_CMD_R_ERR					1004		//Response error,unknow command or syctax error  
#define RTN_CMD_W_ERR					1005		//Write data error
#define RTN_CMD_UNSUPORT				1006

struct TCommand					//structure to describe STX command
{
#ifdef _WIN32_WCE
	TCHAR cAryName[COMMAND_NAME_LENGTH];
	TCHAR *Content;
#else
	char cAryName[COMMAND_NAME_LENGTH];			//name of the command,also the command string
	char *Content;
#endif	
	short Type;	//1 int ;2 double ;3 string ; 4 int array ; 5 with para; 6 with doubl para; 7 string;
	short Param;
	short ReadOnly;	//1 rw ;0 readonly;2 write only;
	double Value;				//value for read command
	double DefaultValue;			//Default value of the variable
};


#endif